<template>
    <el-container class="home-container">
        <el-header>
            <div class="left">
                <img src="../../assets/heima.png" alt="">
                <span>电商后台管理系统</span>
            </div>
            <el-button type="info" @click="logout">退出</el-button>
        </el-header>
        <el-container>
            <el-aside :width="collapse? '65px':'200px'">
                <div class="toggleBar" @click="collapse=!collapse">|||</div>
                <el-menu class="el-menu-vertical-demo" background-color="#333744" text-color="#fff" active-text-color="#3891ff" unique-opened :collapse="collapse" :collapse-transition="false" :default-active="activePath" router>
                    <el-submenu :index="i + ''" v-for="(item,i) in menuList" :key="item.id">
                        <template slot="title">
                            <i :class="['iconfont', iconlist[i]]"></i>
                            <span>{{item.authName}}</span>
                        </template>
                        <!-- :index="childrenItem.id + ''"-->
                        <el-menu-item :index="'/' + childrenItem.path" v-for="childrenItem in item.children" :key="childrenItem.id" @click="setActivePath('/' + childrenItem.path)">
                            <i class="el-icon-setting"></i>
                            <span slot="title">{{childrenItem.authName}}</span>
                        </el-menu-item>
                    </el-submenu>
                </el-menu>
            </el-aside>
            <el-main>
                <router-view></router-view>
            </el-main>
        </el-container>
    </el-container>
</template>
<script>
import mix from './Home-mixins.js'
export default {
  mixins: [mix]
}
</script>
<style lang="less" scoped>
.home-container {
  user-select: none;
  background: #eaedf1;
  height: 100%;
  .el-header {
    background: #373d41;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 0px;
    .left {
      color: #fff;
      font-size: 22px;
      img {
        height: 50px;
        vertical-align: middle;
        margin-right: 10px;
      }
    }
  }
  .el-aside {
    background: #333744;
  }
}
.toggleBar {
  line-height: 25px;
  color: #fff;
  background: #4a5064;
  text-align: center;
  letter-spacing: 0.2em;
  font-size: 12px;
  cursor: pointer;
}
.iconfont {
  margin-right: 8px;
}
.el-submenu {
  width: 200px;
}
</style>
